HWGSLOT hadir sebagai Juwara unggulan yang muncul dari sisi tak terjamah di Indonesia Raya hingga bisa dikenal luas sampai lintas benua asia. Tahun 2026 ini menjadi tahun yang penting bagi kita semua selaku sebagai pengusaha, punggawa ataupun sebagai masyarakat yang mendambakan pilihan terbaik dan lebih sederhana dalam pencarian situs-situs di Internet.
Show More →
`
html.push(body)
}
}
$("#itemAddons .row").html(html.length === 0 ? '
No Item available
' : html)
$("#itemAddons").attr("data-length", products.length)
// $('#itemAddons')[0].swiper.update();
});
})
async function isAddon(){
let ids = []
$("#itemAddons .item-card.selected").each(function(i, e){
const id = $(this).data("id")
ids.push(id)
})
console.log(ids)
return ids
}
$("#itemAddons").delegate(".item-card > div:not(.card-qty)", "click", async function(){
const t = $(this).parent()
const id = t.data("id")
const btn = t.parents(".purchaseAddon").find(".next-purchase-button")
t.toggleClass("selected");
//$(this).next("input").toggleAttr('name', 'id[]');
if (t.hasClass('selected')) {
t.find("input").val(1)
t.find("input").attr('name', 'id[]');
} else {
t.find("input").val(0)
t.find("input").removeAttr('name');
}
$("#properties-addons").val(addons)
const is = await isAddon()
if(is.length === 0) {
btn.text("continue without add-ons")
return
}
if(is.includes(8835692069079)) {
btn.text("personalize acrylic frame")
} else {
btn.text("Continue")
}
})
async function myAddon(data) {
const c = $(".addonsPurchase .addons")
let items = []
const spotifyAddons = $(".spotifyAddons").find("[data-index]")
// if(spotifyAddons.length > 0) {
// $(spotifyAddons).each(function(i, e){
// const spotifyLink = $(this).find(".spotifyLink").val()
// const spotifySong = $(this).find(".spotifySong").val()
// const spotifyArtist = $(this).find(".spotifyArtist").val()
// const spotifyFotoAddon = $(this).find(".resultPhotoSpotify").val()
// if(spotifyLink !== '') {
// spotifyAddon = `
//
//
//
//
// [US] Outerbloom Acrylic Frame 4R
//
//
// Rp 99.000
//
//
//
//
//
//
// spotify link
// ${spotifyLink}
//
//
// uploaded photo
// ${spotifyFotoAddon}
//
//
// song / playlist name
// ${spotifySong}
//
//
// artist name
// ${spotifyArtist}
//
//
//
`
// items.push(spotifyAddon)
// }
// })
// }
for(let i = 0; i < data.length; i++) {
if(data[i].title !== '[US] Outerbloom Acrylic Frame 4R' ) {
const img = data[i].image
const title = data[i].title
const qty = data[i].qty
const price = data[i].price
const total = Number(qty) * Number(price)
let addons = `
${title}
${rupiah.format(price)}
${data[i].title == '[US] Outerbloom Acrylic Frame 4R' ? '' : `x${qty} `}
${rupiah.format(total)}
`
items.push(addons)
}
}
c.html(items)
const parent = $(".purchaseAddon")
const next = parent.next(".sectionPurchase")
parent.addClass("hide")
next.removeClass("hide")
// if(items2.length === 0) return $("#popupCart").addClass("no-addon-cart")
// $(".itemAddonCart").find("h4").text(`add-ons (${items2.length})`)
}
async function listAddon() {
const data = $("#itemAddons").find(".selected")
let ids = []
$(data).each(function(){
const id = $(this).data("variant")
const image = $(this).find(".card-image img").attr("src")
const title = $(this).find(".card-meta h5").text()
const qty = $(this).find(".card-qty input").val()
const price = $(this).find(".card-qty input").data("price")
ids.push({
id: Number(id),
image,
title,
qty,
price
})
})
myAddon(ids)
}
async function customSpotify(idx, length, type){
let isCard = false
let p = $(".purchasePopupSpotify")
const preLink = $(".spotifyLinkFirst").val()
$("[data-index]").hide()
p.find(".headerPurchase h3").text(`personalize spotify photo print${length > 1 ? ` - ${idx}` : ''}`)
p.find(".regulerAddons, .purchase-button").hide()
p.find(".spotifyAddons").show()
const data = await trackUrl(preLink)
const html = `
${data?.song ? `
${data?.song} ` : '
'}${data?.artist ? ` ${data?.artist}
` : '
'}
`
// console.log(html)
$(".spotifyAddons").append(html)
$(`[data-index=${idx}]`).show()
if (preLink !== '') {
$(".btn-action .btn").attr("disabled", false)
} else {
$(".btn-action .btn").attr("disabled", true)
}
return html
}
$(".spotifyLinkFirst").keyup(async function(){
const v = $(this).val()
if(v.includes('spotify:user:spotify')) {
const correct = v.split('user:spotify:')[1]
console.log(correct, 'BNER')
$(this).val(correct)
return
}
if(v.includes("spotify:") || v.includes("https://open.spotify.com/")){
const data = await trackUrl(v)
if(!data || !data.status) {
$(this).parent().addClass("error")
// $(this).parent().append(`
Make sure you copy the complete and correct link from Spotify. Ex: https://open.spotify.com/track/0C3xZJueyBvvMSsl0cETA6
`)
$("#personalizeBtnSpotify .btn").attr("disabled", true)
return
}
$(this).parent().removeClass("error")
// $(this).parent().remove("txt-error")
$("#personalizeBtnSpotify .btn").attr("disabled", false)
} else {
$("#personalizeBtnSpotify .btn").attr("disabled", true)
}
})
$(".purchaseAddon").delegate(".next-addon", "click", function(){
const parent = $(this).parents(".purchaseAddon")
const next = parent.next(".sectionPurchase")
if(next.hasClass("purchaseAddress")) {
if(productType !== '') {
console.log("clarity event " + productType + ' purchaseDelivery')
window.clarity("event", `${productType} purchaseDelivery`)
// window.clarity("set", productType, `purchaseDelivery - ${productDate}`)
}
}
const data = $("#itemAddons").find(".selected")
const length = $(".quantity-cart-46067682607319").val()
const checked = data.length;
if(checked > 0) {
if(length > 0) {
$(".purchaseAddon").addClass("purchaseAddonSpotify")
customSpotify(1, length, 'addon')
} else {
listAddon()
}
} else {
parent.addClass("hide")
next.removeClass("hide")
}
})
$("#personalizeBtnSpotify .btn").click(async function(){
const isCity = $("#cities[required]")
const isDate = $("#propDeliveryDate[required]")
if((isDate.length > 0 && isCity.length > 0) && (isCity.val() === '' || isDate.val() === '')) {
alert('Please choose Delivery City & Delivery Date')
return
}
const data = await customSpotify(1, 1, 'product')
if(data) {
$("#backgroundPopup").fadeIn("slow");
$(".purchasePopupSpotify").fadeIn("slow");
if(productType !== '') {
console.log("clarity event " + productType + ' spotify')
window.clarity("event", `${productType} spotify`)
// window.clarity("set", productType, `purchaseDelivery - ${productDate}`)
}
}
})
function formatBytes(bytes, decimals = 2) {
if (!+bytes) return '0 Bytes'
const k = 1024
const dm = decimals < 0 ? 0 : decimals
const sizes = ['B', 'KB', 'MB']
const i = Math.floor(Math.log(bytes) / Math.log(k))
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`
}
async function trackUrl(link){
try {
let trackId = link.split('/').pop().split('?')[0];
let type = ''
if(link.includes("spotify:")) {
const uri = link.split('spotify:')[1]
trackId = uri.split(':')[1]
type = uri.split(':')[0] + 's'
} else {
if(link.match('track')){
type = 'tracks'
} else if(link.match('playlist')) {
type = 'playlists'
} else if(link.match('artist')) {
type = 'artists'
} else if(link.match('album')) {
type = 'albums'
}
}
console.log(`${host}/api/spotify/${type}/${trackId}`)
const data = await getFetch(`${host}/api/spotify/${type}/${trackId}`)
console.log(data, 'DATA')
const song = data?.data?.name
const artist = data?.data?.artist
return {
song, artist, type, trackId, status: data.status
}
} catch(err) {
console.log(err)
}
}
$(".spotifyAddons").delegate(".uploadPhotoSpotify", "change", async function(){
const parent = $(this).parents("[data-index]")
const preview = parent.find(".previewImage")
const file = $(this)[0].files[0];
if (file) {
const reader = new FileReader();
reader.onload = async function(e) {
parent.find(".uploadResult label").hide()
parent.find(".uploadedResult").remove()
parent.find(".uploadResult").append(`
${file.name} (${formatBytes(file.size)}) is uploaded
`)
parent.find(".frameImageUploaded svg").hide()
parent.find(".frameImage").addClass("uploaded")
preview.attr("src", e.target.result);
preview.show();
let formData = new FormData();
formData.append("file", file);
const response = await fetch(`${host}/api/upload?name=${file.name}&type=image/jpeg&r=${Date.parse(new Date)}`, {
method: "POST",
body: formData
})
const result = await response.json();
if(result){
parent.find(".resultPhotoSpotify").val(result.url)
}
}
reader.readAsDataURL(file);
} else {
preview.hide();
}
});
$(".spotifyAddons").delegate(".uploadResult", "click", function(){
$(this).next("input[type=file]").trigger("click")
})
$(".spotifyAddons").delegate(".changeUpload", "click", function(){
$(this).parents("input[type=file]").trigger("click")
})
$(".spotifyAddons").delegate(".removeUpload", "click", function(){
const parent = $(this).parents("[data-index]")
parent.find(".uploadPhotoSpotify").val("")
parent.find(".uploadResult label").show()
parent.find(".uploadedResult").remove()
parent.find(".frameImageUploaded svg").show()
parent.find(".previewImage").hide()
parent.find(".frameImage").removeClass("uploaded")
})
$(".spotifyAddons").delegate("label.checkbox", "click", function(){
const parent = $(this).parents("[data-index]")
parent.toggleClass("checked")
})
$(".spotifyAddons").delegate(".spotifyLink", "change", async function(){
const parent = $(this).parents("[data-index]")
const link = $(this).val()
const data = await trackUrl(link)
console.log(data)
if(data.song) {
parent.find(".spotifySong").val(data.song)
parent.find(".spotifyData").find("h3").text(data.song)
}
if(data.artist) {
parent.find(".spotifyArtist").val(data.artist)
parent.find(".spotifyData").find("p").text(data.artist)
}
parent.find(".spotifyCode img").attr("src", `https://scannables.scdn.co/uri/plain/png/FFFFFF/black/640/spotify:${data.type.slice(0, -1)}:${data.trackId}`)
// https://scannables.scdn.co/uri/plain/png/FFFFFF/black/640/spotify:track:1er51HCEBhIAtoEemKuC3M
if (data.status === true) {
parent.find(".btn-action .btn").attr("disabled", false)
} else {
parent.find(".btn-action .btn").attr("disabled", true)
}
})
$(".spotifyAddons").delegate(".spotifySong", "keyup", async function(){
const parent = $(this).parents("[data-index]")
const v = $(this).val()
parent.find(".spotifyData h3").text(v)
})
$(".spotifyAddons").delegate(".spotifyArtist", "keyup", async function(){
const parent = $(this).parents("[data-index]")
const v = $(this).val()
parent.find(".spotifyData p").text(v)
})
$(".spotifyAddons").delegate(".btn-action .btn:not(.no-addon)", "click", async function(){
const parent = $(this).parents("[data-index]")
const length = parent.data("length")
const index = parent.data("index")
const indexNext = Number(index) + 1
customSpotify(indexNext, length, 'addon')
})
$(".spotifyAddons").delegate(".btn-action .btn.finished", "click", async function(){
const parent = $(this).parents(".purchaseAddon")
const next = parent.next(".sectionPurchase")
parent.addClass("hide")
next.removeClass("hide")
next.find(".purchase-button").show()
listAddon()
})
$(".spotifyAddons").delegate(".back-spotify", "click", async function(){
const t = $(this).parents("[data-index]")
const parent = $(this).parents(".sectionPurchase")
const current = t.data("index")
const prevCurrent = Number(current) - 1
if(current == 1) {
parent.removeClass("purchaseAddonSpotify")
parent.find(".purchase-button").show()
parent.find(".headerPurchase h3").text("Make It More Special with Add-Ons!")
$(".spotifyAddons").empty()
$(".regulerAddons").show()
return
}
t.hide()
t.prev("[data-index]").show()
t.remove()
parent.find(".headerPurchase h3").text(`personalize spotify photo print - ${prevCurrent}`)
})
$("#personalizeBtn .btn").click(async function() {
loadPopupPersonalize()
});
$(".sectionPurchaseSpotify").delegate(".btn[data-type=card]", "click", function(){
$(".sectionPurchaseSpotify").hide()
loadPopupPersonalize()
})
$(".close-purchase-popup").click(function() {
disablePopup();
});
$("#backgroundPopup").click(function() {
// disablePopup();
});
$("#popupCart .close-purchase-popup").click(function() {
location.reload()
});
$('#popupCart').on('hide.bs.modal', function (e) {
location.reload()
})
$(".next-card").click(function(){
const parent = $(this).parents(".sectionPurchase")
const next = parent.next(".sectionPurchase")
parent.addClass("hide")
next.removeClass("hide")
})
$(".back-purchase-button").click(function(){
const parent = $(this).parents(".sectionPurchase")
const prev = parent.prev(".sectionPurchase")
parent.addClass("hide")
prev.removeClass("hide")
})
$(document).keypress(function(e) {
if (e.keyCode == 27 && popupStatus == 1) {
disablePopup();
}
});
const parentImg = $(".case-img-preview")
const parentVid = $(".case-video-preview")
function readURL(input) {
if (input.files && input.files[0]) {
let reader = new FileReader();
let type = 'image/jpeg'
const size = input.files[0].size
if(input.files[0].type.match('video/')){
type = 'video/mp4'
if(size > 15728640) {
alert('File size exceeds maximum limit 15 MB')
return
}
} else {
if(size > 5242880) {
alert('File size exceeds maximum limit 5 MB')
return
}
}
reader.onload = function (e) {
$(".nextBtn").attr("disabled", true)
if(type === 'image/jpeg') {
$('.placeholder-image').hide();
$('.preview-image').show()
$('.preview-image').attr('src', e.target.result);
} else {
// parentVid.find(".ajax-loader").show();
$(".steps-card-preview").addClass("loading")
}
}
reader.readAsDataURL(input.files[0]);
}
}
async function readURLPapan(input) {
if (input.files && input.files[0]) {
let reader = new FileReader();
reader.onload = function (e) {
$('.btn-upload-papan').siblings('label').hide();
$('.btn-upload-papan img').attr('src', e.target.result);
$('.btn-upload-papan img').show();
$('.svgLogoPapan').hide();
}
const type = 'image/jpeg'
const name = `logo-8144957800663-${Date.parse(new Date())}`
let formData = new FormData();
formData.append("file", input.files[0]);
const response = await fetch(`${host}/api/upload?name=${name}&type=${type}&r=${randomString(3, '0123456789')}`, {
method: "POST",
body: formData
})
const result = await response.json();
if(result) {
const url = result.url
$("[data-properties=papan-logo]").val(url)
}
reader.readAsDataURL(input.files[0]);
}
}
async function readURLAddress(input) {
console.log(input, 'readURLAddress')
if (input.files && input.files[0]) {
let reader = new FileReader();
reader.onload = function (e) {
$('.photo-address').attr('src', e.target.result);
$('.photo-address').show();
}
const type = 'image/jpeg'
const name = input.files[0].name?.split('.')[0]
let formData = new FormData();
formData.append("file", input.files[0]);
const response = await fetch(`${host}/api/upload?name=${name}&type=${type}&r=${randomString(3, '0123456789')}`, {
method: "POST",
body: formData
})
const result = await response.json();
reader.readAsDataURL(input.files[0]);
return result
}
}
async function addToCartUang() {
var productAddOnId1 = 42122101162199;
var productAddOnId2 = 42122101194967;